use dataset_representation, clear

local X 34_2012 35_2012 36_2012 47_2014 57_2016 62_2016 63_2016 64_2016 66_2016

local j = 1

foreach x in `X' {

	if "`x'" == "34_2012" local mytitle "Death penalty repeal"
	if "`x'" == "35_2012" local mytitle ///
		"Human trafficking increase sentences"
	if "`x'" == "36_2012" local mytitle "Soften three-strikes"
	if "`x'" == "47_2014" local mytitle ///
		"Nonviolent offenses to misdemeanors"
	if "`x'" == "57_2016" local mytitle ///
		"Increase parole for nonviolent felons"
	if "`x'" == "62_2016" local mytitle "Death penalty repeal"
	if "`x'" == "63_2016" local mytitle "Gun control"
	if "`x'" == "64_2016" local mytitle "Legalize recreational marijuana"
	if "`x'" == "66_2016" local mytitle "Death penalty speed process"

	local mysubtitle = subinstr("`x'", "_", ", ", 1)
	local mysubtitle = "(Prop " + "`mysubtitle'" + ")"	
	
	preserve
	
		keep if issue == "`x'"
		
		#delimit;
		
		spmap 
			rep_ using dataset_gis
			,
				id(id) 
				fcol(gs10 black)
				ndfcol(white)
				ndocolor(white)
				ocol(white white white white)
				name(g`j', replace)
				title(`mytitle', size(small))
				subtitle(`mysubtitle', size(small))
				clmethod(custom)
				clnumber(3)
				clbreaks(0 0.999 1)
				legend(off)
				;
		
		#delimit cr
		
		gr close

	restore
		
	local j = `j' + 1
	
}

gr combine g1 g2 g3 g4 g5 g6 g7 g8 g9, imargin(zero) ysize(3) xsize(2.2)

gr export "_output/figure 2.png", replace height(2726) width(2000)
